<template>
    <div>
      <p class="title"><i class="el-icon-tickets"></i>平台加盟机构</p>
      <el-table
        border
        :data="tableData"
        style="width: 100%">
        <el-table-column
          type="index">
        </el-table-column>
        <el-table-column
          sortable
          prop="odd"
          label="加盟号">
        </el-table-column>
        <el-table-column
          prop="name"
          label="负责人">
        </el-table-column>
        <el-table-column
          prop="status"
          label="加盟机构"
          width="130">
        </el-table-column>
        <el-table-column
          prop="amount"
          label="联系电话">
        </el-table-column>
        <el-table-column
          prop="date"
          label="加盟时间"
          sortable
        >
        </el-table-column>
        <el-table-column
          prop="tag"
          label="学校邮箱"
          width="170">
        </el-table-column>
        <el-table-column label="操作">
          <template slot-scope="scope">
            <el-button
              size="mini"
			  type="success"
              @click="handleEdit(scope.$index, scope.row)">查看LOGO</el-button>
          </template>
        </el-table-column>
      </el-table>
	  
	  <el-dialog
	    :title="title"
	    :visible.sync="dialogVisible"
		top="30px"
	    >
	    <img :src="src"></img>
	    <span slot="footer" class="dialog-footer">
	      <el-button @click="dialogVisible = false">返 回</el-button>
	      <!-- <el-button type="primary" @click="dialogVisible = false">确 定</el-button> -->
	    </span>
	  </el-dialog>
    </div>
</template>

<script>
export default {
  name: 'maintable',
  data () {
    return {
      tableData: [{
        odd: '20200101000001',
        name: '李源',
        status: '井冈山大学',
        amount: '13033296578',
        date: '2020-01-01',
        tag: '2043928998@qq.com'
      }, {
        odd: '20200101000002',
        name: '谢智勇',
        status: '安徽大学',
        amount: '17895054231',
        date: '2020-01-01',
        tag: '2043928998@qq.com'
      }, {
        odd: '20200101000003',
        name: '王小虎',
        status: '江西科技学院',
        amount: '17895054231',
        date: '2020-01-01',
        tag: '2043928998@qq.com'
      }, {
        odd: '20200101000004',
        name: '上官桂芬',
        status: '福州中学',
        amount: '13022586428',
        date: '2019-01-01',
        tag: '2043928998@qq.com'
      }, {
        odd: '20200101000005',
        name: '薛国鹏',
        status: '星空大学',
        amount: '13033296279',
        date: '2020-01-01',
        tag: '2043928998@qq.com'
      }],
	   dialogVisible: false,
	   title: 'logo',
	   src: '../../../static/images/icon2.png'
    }
  },
  created() {
	  this.axios.get(this.server + "/index/tableMsg?token=" + this.store.getters.token).then(res => {
		  this.tableData = res.data;
	  },res => {
		  
	  })
  },
  methods: {
    handleEdit (index, row) {
		this.dialogVisible = true
		this.title = row.status
		this.src = ''
		// //发送请求查询图片
		this.axios.get(this.server + "/index/getSchoolLogoById?odd=" + row.odd + "&token=" + this.store.getters.token).then(res => {
			if(res.data == '0') {
				this.src = '../../../static/images/icon2.png'
				// that.avatar = './static/images/icon2.png';
			}else {
				// that.avatar = './static/images/icon2.png';
				this.src = 'data:image/png;base64,' + res.data;
			}
		},res => {
			this.src = '../../../static/images/icon2.png'
			// that.avatar = './static/images/icon2.png';
		})
    },
    handleDelete (index, row) {
      console.log(index, row)
      this.$message({
        showClose: true,
        message: index, row,
        type: 'success'
      })
    },
    formatter (row, column) {
      return row.address
    },
    filterTag (value, row) {
      return row.tag === value
    },
    filterHandler (value, row, column) {
      const property = column['property']
      return row[property] === value
    }
  }
}
</script>

<style scoped>

</style>
